<?php
// TODO: update/comment
class Plus_Form_Admin_MailCategory_Edit extends Zend_Form
{	
	public function init()
	{
		$this->setMethod('post');
	}
	
	public function makeList(array $objects)
	{
		$this->setAction('/admin/mailcategoryEdit');
		
		//var_dump($countries);
		$multiOptions = array();
		foreach ($objects as $object) {
			$multiOptions[$object->getId()] = $object->getName();
		}	
		$this->addElement('select', 'mail_category', array(
			'label' => 'Choose service version You wish to edit',
			'multioptions' => $multiOptions
		));
		
		$this->addElement('submit', 'doEdit', array(
			'ignore'	=> true,
			'label'		=> 'Edit selected service version'
		));
		
		$this->addElement('submit', 'doDelete', array(
			'ignore'	=> true,
			'label'		=> 'Delete selected service version',
			'value'		=> true
		));
	}
	
	public function makeEdit($service)
	{
		$this->setAction('/admin/mailcategoryUpdate');
		
		$this->addElement('text', 'Name', array(
			'label' 	=> 'Service version name:',
			'required' 	=> true,
			'value'		=> $service->getName()
		));
		
		$this->addElement('text', 'Description', array(
			'label' 	=> 'Service version description:',
			'required' 	=> true,
			'value'		=> $service->getDescription()
		));
		
		$this->addElement('checkbox', 'IsEnabled', array(
			'label'		=> 'Enable this Service version for users?',
			'checked' 	=> true,
			'value'		=> $service->getIsEnabled()
		));
		
		$this->addElement('submit', 'submit', array(
			'ignore'	=> true,
			'label'		=> 'Update Service version data'
		));
		
		$this->addElement('reset', 'reset', array(
			'label'		=> 'Reset changes'
		));
		
		$this->addElement('hash', 'csrf', array(
			'ignore'	=> true
		));
		
		/*$this->addElement('hidden', 'IdName', array(
			'value'		=> $country->getIdName()		
		));*/
		
		$this->addElement('hidden', 'Id', array(
			'value'		=> $service->getId()		
		));
	}
}